package com.yaodian100.ec.timelimitsale.service.remote;

import java.io.IOException;
import java.text.ParseException;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;

import com.yaodian100.core.common.exception.CoreException;
import com.yaodian100.ec.timelimitsale.service.TimeLimitSaleService;

/**
 * 
 * @author apple.chang
 * 
 */
public class RemoteTimeLimitSaleServiceImpl implements RemoteTimeLimitSaleService {

	@Autowired
	private TimeLimitSaleService timeLimitSaleService;

	@Override
	public boolean updateData(String date) throws ParseException, CoreException, IOException {
		System.out.println("RemoteTimeLimitSaleServiceImpl updateData:{}" + date + "; " + new Date());
		return timeLimitSaleService.updateData(date);
	}

	@Override
	public boolean generateTimeLimitSaleList(String date) throws ParseException, CoreException, IOException {
		try {
			System.out.println("RemoteTimeLimitSaleServiceImpl generateTimeLimitSaleList:{}" + date + "; " + new Date());
			return timeLimitSaleService.generateTimeLimitSaleList(date, 0);
		} catch (Exception e) {
			System.out.println("RemoteTimeLimitSaleServiceImpl generateTimeLimitSaleList exception:{}" + e.getMessage());
			return false;
		}
	}

	@Override
	public boolean generateMTimeLimitSaleList(String date) {
		try {
			System.out.println("RemoteTimeLimitSaleServiceImpl generateMTimeLimitSaleList:{}" + date + "; " + new Date());
			return timeLimitSaleService.generateMTimeLimitSaleList(date);
		} catch (Exception e) {
			System.out.println("RemoteTimeLimitSaleServiceImpl generateMTimeLimitSaleList exception:{}" + e.getMessage());
			return false;
		}
	}

	@Override
	public boolean sendTimeLimitSaleStatusList(String date) throws ParseException {
		return timeLimitSaleService.sendTimeLimitSaleStatusList(date, 0);
	}
}